<style lang="less">
</style>

<template>
  <div>
    <Row gutter="4">
      <Col span="12">
        <Card shadow>
          <p slot="title">
            <Icon type="ios-film-outline"></Icon>
            库存列表
          </p>
          <inventory-list ref="list1" v-on="{clickInventory:clickInventory,refreshDetails:refreshDetails}"></inventory-list>
        </Card>
      </Col>
      <Col span="12">
        <Card shadow>
          <p slot="title">
            <Icon type="ios-film-outline"></Icon>
            库存明细
          </p>
          <inventory-details-list ref="list2" :inventoryId="inventoryId"></inventory-details-list>
        </Card>
      </Col>
    </Row>
  </div>
</template>

<script>
    import inventoryList from '@/view/inventory/list/InventoryList.vue';
    import inventoryDetailsList from '@/view/inventory/list/InventoryDetailsList.vue';
    import iviewTable from '@/view/common/table/Table.vue';
    import iviewPage from '@/view/common/page/Page.vue';
    export default {
        components: {
            iviewTable,
            iviewPage,
            inventoryList,
            inventoryDetailsList
        },
        data () {
            return {
                inventoryId: ''
            };
        },
        methods: {
            events (item) {
            },
            clickInventory (row) {
                this.inventoryId = row.id
            },
            changeSelect (rows) {
                this.selectRows = rows
            },
            changeTotalSize (totalSize) {
                this.pageModel.totalSize = totalSize
            },
            changePageNumber (pageNumber) {
                this.pageModel.pageNumber = pageNumber
            },
            changePageSize (pageSize) {
                this.pageModel.pageSize = pageSize
            },
            refresh () {
                this.$refs.list1.refresh()
            },
            refreshDetails () {
                this.$refs.list2.refresh()
            },
            init () {
                this.refresh()
                this.refreshDetails()
            }
        },
        mounted () {
            this.init()
        },
        watch: {
            '$route' (to) {
                if (to.path === '/store/inventory') {
                    this.init()
                }
            }
        }
    }
</script>

<style>

</style>
